package com.ruoyi.system.service.honor.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.honor.studentmeeting.StudentMeetingInfo;
import com.ruoyi.system.mapper.honor.StudentMeetingInfoMapper;
import com.ruoyi.system.service.honor.IStudentMeetingInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.ruoyi.common.utils.SecurityUtils.getUserId;

/**
 * 学生学术会议Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-11
 */
@Service
public class StudentMeetingInfoServiceImpl implements IStudentMeetingInfoService
{
    @Autowired
    private StudentMeetingInfoMapper studentMeetingInfoMapper;

    /**
     * 查询学生学术会议
     * 
     * @param id 学生学术会议主键
     * @return 学生学术会议
     */
    @Override
    public StudentMeetingInfo selectStudentMeetingInfoById(Long id)
    {
        return studentMeetingInfoMapper.selectStudentMeetingInfoById(id);
    }

    /**
     * 查询学生学术会议列表
     * 
     * @param studentMeetingInfo 学生学术会议
     * @return 学生学术会议
     */
    @Override
    public List<StudentMeetingInfo> selectStudentMeetingInfoList(StudentMeetingInfo studentMeetingInfo)
    {
        if(studentMeetingInfo.getCurrentRole()!=null&&studentMeetingInfo.getCurrentRole().equals("teacher")){
            studentMeetingInfo.setTeacherId(getUserId());
        }
        //如果是部门，则显示老师是系里的所有
        if(studentMeetingInfo.getCurrentRole()!=null&&studentMeetingInfo.getCurrentRole().equals("department")){
            studentMeetingInfo.setDeptId(SecurityUtils.getDeptId());
        }
        return studentMeetingInfoMapper.selectStudentMeetingInfoList(studentMeetingInfo);
    }

    /**
     * 新增学生学术会议
     * 
     * @param studentMeetingInfo 学生学术会议
     * @return 结果
     */
    @Override
    public int insertStudentMeetingInfo(StudentMeetingInfo studentMeetingInfo)
    {
        return studentMeetingInfoMapper.insertStudentMeetingInfo(studentMeetingInfo);
    }

    /**
     * 修改学生学术会议
     * 
     * @param studentMeetingInfo 学生学术会议
     * @return 结果
     */
    @Override
    public int updateStudentMeetingInfo(StudentMeetingInfo studentMeetingInfo)
    {
        return studentMeetingInfoMapper.updateStudentMeetingInfo(studentMeetingInfo);
    }

    /**
     * 批量删除学生学术会议
     * 
     * @param ids 需要删除的学生学术会议主键
     * @return 结果
     */
    @Override
    public int deleteStudentMeetingInfoByIds(Long[] ids)
    {
        return studentMeetingInfoMapper.deleteStudentMeetingInfoByIds(ids);
    }

    /**
     * 删除学生学术会议信息
     * 
     * @param id 学生学术会议主键
     * @return 结果
     */
    @Override
    public int deleteStudentMeetingInfoById(Long id)
    {
        return studentMeetingInfoMapper.deleteStudentMeetingInfoById(id);
    }
}
